<?php
class Core_Book
	extends Core_Abstract
{
	protected $id;

	protected $systemId;
	
	protected $name;
	
	protected $descp;
	
	public function setId($id)
	{
		$this->id	= (int) $id;
	}
	
	public function getId()
	{
		return $this->id;
	}
	
	public function setSystemId($system)
	{
		if ($system instanceof Core_System)
		{
			return $this->systemId	= $system->getId();
		}
		
		$this->systemId	= $system;
	}
	
	public function getSystemId()
	{
		return $this->systemId;
	}
	
	public function setName($name)
	{
		$this->name	= $name;
	}
	
	public function getName()
	{
		return $this->name;
	}
	
	public function setDescp($descp)
	{
		$this->descp	= $descp;
	}
	
	public function getDescp()
	{
		return $this->descp;
	}	
	
	public function toXml($xml = null)
	{
		$xml	= null == $xml ? simplexml_load_string("<book></book>") : $xml;
		$xml->addattribute('id', $this->getId());
		$xml->addattribute('sysId', $this->getSystemId());
		$xml->addChild('name', htmlentities($this->getName(), ENT_QUOTES));
    	$xml->addChild('descp', htmlentities($this->getDescp(), ENT_QUOTES));
    	return $xml;		
	}
}